package com.iotp.service.expert;

import com.iotp.dao.expert.ExpertMapper;
import com.iotp.entity.expert.Expert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("expertService")
public class ExpertServiceImpl implements ExpertService {
    @Autowired
    private ExpertMapper expertMapper;

    @Override
    public Long add(Expert expert) {
        this.expertMapper.insert(expert);
        return expert.getId();
    }

    @Override
    public void update(Expert expert) {
        this.expertMapper.updateByPrimaryKeySelective(expert);
    }

    @Override
    public Expert queryById(Long id) {
        return this.expertMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Expert> queryList(Expert expert) {
        return this.expertMapper.selectByCondition(expert);
    }

    @Override
    public List<Expert> queryLimit() {
        return this.expertMapper.selectLimit();
    }

    @Override
    public void delete(Long id) {
        this.expertMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Expert queryByUserId(String userId) {
        return this.expertMapper.selectByUserId(userId);
    }

}
